<!doctype html>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../assert_selection.js"></script>
<script>
    test(() => {
        assert_not_equals(window.internals, undefined,
            'This test requires window.internals');
        ['mac', 'win', 'unix', 'android'].forEach(platform => {
            internals.settings.setEditingBehavior(platform);
            assert_selection(
                '<div contenteditable><pre>^foo|\n</pre></div>',
                'delete',
                '<div contenteditable><pre>|\n</pre></div>',
                `${platform}: Delete a paragraph in preserving newline`);

            assert_selection(
                '<div contenteditable><pre>^foo|\n</pre></div>',
                selection => {
                    selection.document.execCommand('delete');
                    selection.document.execCommand('undo');
                },
                '<div contenteditable><pre>^foo|\n</pre></div>',
                '${platform}: Undo after delete a paragraph in preserving newline');
        });
    });
</script>
